package com.symaster.common.swing.element.button;

import javax.swing.*;
import java.awt.*;

/**
 * @author yinmiao
 * @date 2022-03-19 14:59
 */
public class Button extends AbstractButton {

    private String text;
    private Icon icon;
    private Dimension iconSize;
    private String iconName;

    public Button() {
    }

    public Button(String text) {
        this.text = text;
    }

    public Button(String text, Icon icon) {
        this.text = text;
        this.icon = icon;
    }

    public Button(String text, Icon icon, Dimension iconSize) {
        this.text = text;
        this.icon = icon;
        this.iconSize = iconSize;
        this.iconName = iconName;
    }

    public Button(Dimension iconSize, String iconName) {
        this.iconSize = iconSize;
        this.iconName = iconName;
    }

    public Button(String text, Dimension iconSize, String iconName) {
        this.text = text;
        this.iconSize = iconSize;
        this.iconName = iconName;
    }

    private void initDefaultData() {
        if (iconSize == null) {
            iconSize = new Dimension(25, 25);
        }
    }

    private void initPage() {
        setLayout(new BorderLayout());
    }

    @Override
    public String getText() {
        return text;
    }

    @Override
    public void setText(String text) {
        this.text = text;
    }

    @Override
    public Icon getIcon() {
        return icon;
    }

    @Override
    public void setIcon(Icon icon) {
        this.icon = icon;
    }

    public Dimension getIconSize() {
        return iconSize;
    }

    public void setIconSize(Dimension iconSize) {
        this.iconSize = iconSize;
    }

    public String getIconName() {
        return iconName;
    }

    public void setIconName(String iconName) {
        this.iconName = iconName;
    }
}
